package com.nengchuan.eic.nceconomy.config;

import com.nengchuan.eic.nceconomy.component.excel.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
public class ExcelConfig {

    @Primary
    @Bean
    public BaseHandler baseExcelHandler(RoughCalculationSubstationAvxHandler rcs,
                                        RoughCalculationOverheadLineAvxHandler rco,
                                        BudgetCalculationSubstationAvxHandler bcs,
                                        BudgetCalculationOverheadLineAvxHandler bco,
                                        SettleAccountsOverheadLineAvxHandler sao,
                                        SettleAccountsSubstationAvxHandler sas){
        rcs.setNextHandler(rco);
        rco.setNextHandler(bcs);
        bcs.setNextHandler(bco);
        bco.setNextHandler(sao);
        sao.setNextHandler(sas);
        return rcs;
    }

    @Bean
    RoughCalculationOverheadLineAvxHandler roughCalculationOverheadLineAvxHandler(){
        return new RoughCalculationOverheadLineAvxHandler();
    }

    @Bean
    SettleAccountsOverheadLineAvxHandler settleAccountsOverheadLineAvxHandler(){
        return new SettleAccountsOverheadLineAvxHandler();
    }

    @Bean
    SettleAccountsSubstationAvxHandler settleAccountsSubstationAvxHandler(){
        return new SettleAccountsSubstationAvxHandler();
    }
    @Bean
    RoughCalculationSubstationAvxHandler roughCalculationSubstationAvxHandler(){
        return new RoughCalculationSubstationAvxHandler();
    }

    @Bean
    BudgetCalculationOverheadLineAvxHandler budgetCalculationOverheadLineAvxHandler(){
        return new BudgetCalculationOverheadLineAvxHandler();
    }

    @Bean
    BudgetCalculationSubstationAvxHandler budgetCalculationSubstationAvxHandler(){
        return new BudgetCalculationSubstationAvxHandler();
    }

}
